<extend name="Public/base"/>

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{$title}</h2>
    </div>
    <!--信息栏-->
    <div class="form-item" style="float: left">
        <span style="font-weight: bold;display: inline-block;margin-bottom: 8px;font-size: 16px;">{$store.brand|default=''}（{$store.store_name|default=''}）</span>
        <br>
        <span style="font-weight: bold;display: inline-block;margin-bottom: 8px;font-size: 14px;">{$store.address|default=''}</span>
    </div>
    <!--返回按钮-->
    <div style="float: right;">
        <p style="height: 15px"></p>
        <button class="btn" onclick="javascript:history.back(-1);return false;" style="margin-right: -0px;">返 回</button>
    </div>
    <!-- 数据列表 -->
    <div class="data">
        <table class="">
            <thead>
            <tr>
                <th class="public_tanle_qianmian">活动内容图</th>
                <th class="public_tanle_qianmian">活动内容标题</th>
                <th class="public_tanle_qianmian">创建时间</th>
                <th class="public_tanle_qianmian">状态</th>
                <th class="public_content_lost1">操作</th>
            </tr>
            </thead>
            <tbody>
            <notempty name="list">
                <volist name="list" id="vo">
                    <tr>
                        <td class="public_content_qianmian" width="280px"><img src="{$vo.activity_img_url}" style="width: 280px;height: 140px;" /></td>
                        <td class="public_content_qianmian">{$vo.title|default='--'}</td>
                        <td class="public_content_qianmian" width="220px;">{$vo.datetime|default='--'}</td>
                        <if condition='$vo.status eq 1'>
                            <td class="public_content_qianmian" width="120px;" style="color: green;font-weight: bold;">启用中</td>
                            <td class="public_content_lost1 public_content_jl" style="text-align:center;width: 120px;">
                                <a href="{:U('content_detail?id='.$vo['id'])}" class="reward_pass" style="margin-right: 8px;">详情</a>
                                <a href="{:U('store_content_off?store_id='.$store['id'].'&cid='.$vo['cid'])}" class="del">停用</a>
                            </td>
                        <else />
                            <td class="public_content_qianmian" width="120px;" style="color: #8a8a8a">停用中</td>
                            <td class="public_content_lost1 public_content_jl" style="text-align:center;width: 120px;">
                                <a href="{:U('content_detail?id='.$vo['id'])}" class="reward_pass" style="margin-right: 8px;">详情</a>
                                <a href="{:U('store_content_on?store_id='.$store['id'].'&cid='.$vo['cid'])}" class="del">启用</a>
                            </td>
                        </if>
                    </tr>
                </volist>
                <else/>
                <td colspan="100" class="text-center"> 暂时没有内容 </td>
            </notempty>
            </tbody>
        </table>
    </div>
    <!-- 分页 -->
    <div class="page">
        {$page}
    </div>
</block>

<block name="script">
    <link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
    <php>if(C('COLOR_STYLE')=='blue_color') echo '<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">';</php>
    <link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
    <script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js" charset="UTF-8"></script>
    <!-- 引入CSS、JS开始 -->
    <link href="__CSS__/wash_helper/gm_table_public.css" rel="stylesheet" type="text/css">
    <!-- 引入CSS、JS结束 -->
    <script type="text/javascript">
        /* 当前子菜单栏高亮 */
        highlight_subnav('{:U('Activity/store')}');

        $(function () {
            /* 无刷新停/启用 */
            $('.del').click(function(){
                var target;
                var that = this;

                target = $(this).attr('href');
                $.get(target).success(function(data){
                    if (data.status==1) {
                        if (data.url) {
                            updateAlert(data.info + ' 页面即将自动跳转~','alert-success');
                        }else{
                            updateAlert(data.info,'alert-success');
                        }
                        setTimeout(function(){
                            if (data.url) {
                                location.href=data.url;
                            }else if( $(that).hasClass('no-refresh')){
                                $('#top-alert').find('button').click();
                            }else{
                                location.reload();
                            }
                        },1500);
                    }else{
                        updateAlert(data.info);
                        setTimeout(function(){
                            if (data.url) {
                                location.href=data.url;
                            }else{
                                $('#top-alert').find('button').click();
                            }
                        },1500);
                    }
                });
                return false;
            });
        })
    </script>
</block>